package com.tuanzi.loan.vo.response.family;

import com.tuanzi.loan.core.vo.IdentityResponse;
import lombok.Data;
import lombok.EqualsAndHashCode;

import java.io.Serializable;
import java.math.BigDecimal;
import java.util.Date;
@Data
@EqualsAndHashCode(callSuper = true)
public class WholeSaleStatSearchResponse extends IdentityResponse implements Serializable{
    private static final long serialVersionUID = 2847813967791080789L;

    private Date date;
    private String from_id;
    private String owner;
    private Integer writenum;//填写用户数
    private Integer orderuser;//成功提单用户数
    private BigDecimal writeorder;
    private BigDecimal writeallorder;
    private Integer faileorder;//提单失败用户数
    private Integer earnordernum;//提单用户数 = 提单失败 failorder + 成功提单用户数 orderuser
    public BigDecimal getWriteorder() {
        if (getEarnordernum()==null||new BigDecimal(getEarnordernum()).compareTo(BigDecimal.ZERO)==0||orderuser==null){
            return BigDecimal.ZERO;
        }else{
            return new BigDecimal(orderuser).divide(new BigDecimal(getEarnordernum()),BigDecimal.ROUND_HALF_DOWN,1);
        }
    }

    public void setWriteorder(BigDecimal writeorder) {
        this.writeorder = writeorder;
    }



    public Integer getEarnordernum() {
        return this.faileorder+this.orderuser;
    }

    public void setEarnordernum(Integer earnordernum) {
        this.earnordernum = earnordernum;
    }

    public BigDecimal getWriteallorder() {
        if (writenum==null||new BigDecimal(writenum).compareTo(BigDecimal.ZERO)==0||getEarnordernum()==null){
            return BigDecimal.ZERO;
        }else{
            return new BigDecimal(getEarnordernum()).divide(new BigDecimal(writenum),BigDecimal.ROUND_HALF_DOWN,1);
        }
    }

    public void setWriteallorder(BigDecimal writeallorder) {
        this.writeallorder = writeallorder;
    }
}
